package day03;

import java.util.Scanner;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/4/10
 */
public class IntReverse {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个整数");
        int i = sc.nextInt();
        int reversed = 0;

        while (i != 0) {
            int digit = i % 10;  // 获取最后一位数字
            reversed = reversed * 10 + digit;  // 将数字添加到反转数中
            i = i / 10;  // 去掉最后一位
        }

        System.out.println("倒排后的整数: " + reversed);
    }

}
